package com.magicalcoder.pigeontest.service.impl;



import com.magicalcoder.pigeon.ioc.anotation.Resource;
import com.magicalcoder.pigeon.ioc.anotation.Service;
import com.magicalcoder.pigeontest.model.Admin;
import com.magicalcoder.pigeontest.model.Person;
import com.magicalcoder.pigeontest.service.HelloPersonService;
import com.magicalcoder.pigeontest.service.HelloService;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * Created by luxiaoxun on 2016-03-10.
 */
@Service("helloPersonService")
public class HelloPersonServiceImpl implements HelloPersonService {

    @Resource
    private HelloService helloService;
    @Resource("connectionManagerTemplate")
    private ConnectionManagerTemplate connectionManagerTemplate;

    @Override
    public List<Person> GetTestPerson(String name, int num) {
        List<Person> persons = new ArrayList<>(num);
        persons.add(new Person(Integer.toString(num), name));
        List<Admin> admins = connectionManagerTemplate.selectList("select id,user_name userName,password from admin_user limit 100", Admin.class);
        System.out.println("数据库查询出个数："+admins.size());
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return persons;
    }
}
